<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>默认绑定</title>
</head>

<body>
  <script>
    // 函数的独立调用 
    function foo() {
      console.log("foo函数", this);
    }
    foo(); //window

    const obj = {
      baz: '123',
      bar: function () {
        console.log('obj中', this);
      }
    }
    obj.bar(); //obj
    var obj1 = obj.bar
    obj1() //window

    function test(fn){
      fn()
    }
    test(obj.bar) //window,相当于独立调用
    // ps:严格模式下，独立函数的调用的this指向undefined
  </script>


</body>

</html>